# -*- coding:utf-8 -*-
from pip._vendor.distlib.compat import raw_input

__author__ = 'gin.chen'

##平面最大点
"""
P为给定的二维平面整数点集。定义 P 中某点x，如果x满足 P 中任意点都不在 x 的右上方区域内（横纵坐标都大于x），
则称其为“最大的”。求出所有“最大的”点的集合。（所有点的横坐标和纵坐标都不重复, 坐标轴范围在[0, 1e9) 内）

"""

def compare_x_y(point_x, point_y):
    if point_x[0] < point_y[0] and point_x[1] > point_y[1]:
        return 1
    return 0


def sort_by(point_number, point_array):
    for i in range(0, point_number):
        point_tmp = i
        for j in range(i + 1, point_number):
            if point_array[j][0] < point_array[point_tmp][0]:
                point_tmp = j
        if point_array[point_tmp][0] != point_array[i][0]:
            point_array[i], point_array[point_tmp] = point_array[point_tmp], point_array[i]


def sort_list(point_number, point_array):
    for i in range(0, point_number - 1):
        z = 0
        for j in range(i + 1, point_number):
            if compare_x_y(point_array[i], point_array[j]):
                z += 1
            if z == point_number - i - 1:
                print(point_array[i])
    print(point_array[point_number - 1])


if __name__ == '__main__':
    point_number = input("Enter the point number:")
    point_array = []
    for i in range(0, int(point_number)):
        point_index = raw_input("Enter the point index:")
        point_array.append(list(map(int, point_index.split(" "))))

    sort_by(len(point_array), point_array)
    sort_list(len(point_array), point_array)
